<template>
	<view class="container">
		<template v-if="State && ID>0">
			<view class="headimg"><image src="/static/success.png" mode="aspectFill"/></view>
			<view class="line">{{Msg}}</view>
		</template>
		<template v-if="!State && ID>0">
			<view class="headimg"><image src="/static/error.png" mode="aspectFill"/></view>
			<view class="line">{{Msg}}</view>
		</template>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				ID:0,
				Lat:0,
				Lng:0,
				Msg:'',
				ActiveID:0,
				State:false
			};
		},
		onLoad(options) {
			this.ActiveID = parseInt(decodeURIComponent(options.scene));
			uni.getLocation({
			  type: 'wgs84', // 默认为wgs84的gps坐标，如果要返回直接给openLocation用的火星坐标，可传入'gcj02'
			  success: res=> {
			    this.Lat = res.latitude; // 纬度，浮点数，范围为90 ~ -90
			    this.Lng = res.longitude; // 经度，浮点数，范围为180 ~ -180。	
				this.Save_ActiveSign();
			  },
			  fail: res=>{
				  this.Save_ActiveSign();
			  }
			});
		},
		methods:{
			Save_ActiveSign(){
				var data = {};
				data.Act="Save_ActiveSign";
				data.ActiveID = this.ActiveID;
				data.Lat = this.Lat;
				data.Lng = this.Lng;
				this.Util.Loading("正在签到...");
				this.Util.Post(data, json=>{
					this.Util.HideLoading();
					this.State=json.State;
					this.Msg=json.Msg;
					this.ID=json.Data;
					if(json.State){
						this.Util.Toast(json.Msg);
					}else{
						this.Util.Alert(json.Msg);
					}
				});		
			}
		}
	}
</script>

<style lang="scss">
	page{background-color: #ffffff;}
	.headimg{width:100%; height:auto; text-align:center; margin-top:40rpx; image{width:300rpx; height:300rpx;}}
	.line{width:100%; min-height:60rpx; line-height: 60rpx; text-align: center; font-size:42rpx; padding-left:30rpx; padding-right: 30rpx;}
	.tip{width:100%; height:120rpx; line-height: 40rpx; text-align:center; margin-top:40rpx; color:#007AFF;}
</style>
